# -*- coding: utf-8 -*-
"""
Created on Fri Sep 25 18:48:20 2020

@author: 于江

"""

from .emotion_analyse import emotion_analyse
from .space_analyse import space_analyse
from .text_flesh import text_flesh
from .time_analyse import time_analyse
from .user_tools import clean_tmp

__all__ = ["main"]


def main():
    """
    主函数
    """
    
    clean_tmp()
    m = input("请输入情绪分析模式：\n0:情绪混合\n1:最大值优先，默认\n")
    MODE = (1 if m != "0" else 0)
    print("已选择情绪分析模式{}".format(MODE))

    emotion_kinds = ["Anger", "Disgust", "Fear", "Joy", "Sadness"]

    print("\n处理开始：⬇\n")

    data = text_flesh("./data/weibo.txt")
    print("数据清洗结束。\n")

    emotion_list = emotion_analyse(data[0], mode=MODE)
    print("情绪分析结束。\n")

    time_analyse(emotion_kinds, emotion_list, data[2], mode=MODE)
    print("情绪-时间分布已输出。\n")

    space_analyse(emotion_kinds, emotion_list, data[1], mode=MODE)
    print("情绪-空间分布已输出。\n")

    print("\n处理结束。❤")


if __name__ == "__main__":
    main()
